package org.feng.controller;

import io.swagger.annotations.Api;
import lombok.AllArgsConstructor;
import org.feng.base.entity.Result;
import org.feng.service.EmailService;
import org.feng.vo.EmailMessageVO;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

/**
 * @Author feng
 * @Date 2022/6/6 17:42
 * @Description 发送邮件
 */
@RestController
@RequestMapping("/sms/email")
@AllArgsConstructor
@Api(tags = "发送邮件")
public class EmailController {

    private EmailService emailService;


    @PostMapping("/sendEmail")
    public Result<Boolean> sendEmail(@RequestBody EmailMessageVO message) {
        return Result.success(emailService.sendEmail(message));
    }

    @PostMapping("/sendEmailWithAttach")
    public Result<Boolean> sendEmailWithAttach(@RequestBody EmailMessageVO message, @RequestParam MultipartFile[] file) {
        return Result.success(emailService.sendEmailWithAttach(message, file));
    }

}
